import React from 'react'
import './App.scss'
import { Router, Redirect, Route, Switch } from 'react-router-dom'
import Layout from '@/pages/Layout/Layout'
import Login from '@/pages/Login/Login'
import history from './utils/history'
import ProfileEdit from './pages/Profile/Edit/Edit'
import { PrivateRoute } from './components/PrivateRoute'
import Chat from './pages/Profile/Chat/Chat'
import Article from './pages/Article/Article'
import Search from '@/pages/Search/Search'
import Result from '@/pages/Search/Result/Result'
import KeepAlive from './components/KeepAliveRoute'

function App () {
  return (
    // 测试git
    <div className="App">
      <Router history={history}>
        <KeepAlive path="/home">
          <Layout />
        </KeepAlive>
        <Switch>
          {/* <Redirect exact from="/" to="/home" /> */}
          <Route path="/" exact render={() => <Redirect to="/home" />} />
          {/* <Route path="/home" component={Layout} /> */}
          <Route path="/login" component={Login} />
          <PrivateRoute path="/profile/edit">
            <ProfileEdit />
          </PrivateRoute>
          <PrivateRoute path="/chat">
            <Chat />
          </PrivateRoute>
          <Route path="/article/:id">
            <Article />
          </Route>
          <Route exact path="/search">
            <Search />
          </Route>
          <Route exact path="/search/result">
            <Result />
          </Route>
        </Switch>
      </Router>
    </div>
  )
}

export default App
